package viv.karaoke.book;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class ProfileAdapter extends ArrayAdapter<String> {

	private Context mContext;
	private String[] values;
	private int layoutResourceId;
	
//	public ProfileAdapter(Context c) {
//		mContext = c;
//	}
	
	public ProfileAdapter(Context context, int layoutResourceId, String[] values) {
	    super(context, layoutResourceId, values);
	    this.mContext = context;
	    this.values = values;
	    this.layoutResourceId = layoutResourceId;
	  }
	
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return values.length;
	}

	@Override
	public String getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
//		LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		LayoutInflater inflater = ((Activity)mContext).getLayoutInflater();
		View rowView = inflater.inflate(layoutResourceId, parent, false);
		TextView textView = (TextView) rowView.findViewById(viv.karaoke.book.R.id.txtTitle);
		// ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
		textView.setText(values[position]);
		    
		return rowView;
	}

}
